﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;
using System.Web;

namespace WebSys.UI.ZhengShou.BCSSManage
{
    public class hetongCQprint : Page
    {
        protected override void OnLoad(EventArgs e)
        {
            EluZSProvider.EluZSDataProvider _EluZSDataProvider = (EluZSProvider.EluZSDataProvider)Antu.Core.Services.ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
            string strid = HttpContext.Current.Request["ID"];
            string iid = _EluZSDataProvider.GetSomeStr("zs_cqzhxy", "iid", "id", strid);

            TextBox showtempurl = (TextBox)FindControl("showtempurl");
            TextBox showtempurlo = (TextBox)FindControl("showtempurlo");
            string tempurl = string.Empty;
            string tempurlo = string.Empty;
            StringBuilder sbr1 = new StringBuilder();
            StringBuilder sbr2 = new StringBuilder();

            for (int temp = 1; temp < 16; temp = temp + 2)
            {
                //string tempstr = "房屋征收货币补偿协议";
                //tempstr += temp;
                //tempurl += Bind2(tempstr) + ";";
                string newtemp = string.Empty;
                if (temp.ToString().Length == 1) { newtemp = "0" + temp.ToString(); }
                else { newtemp = temp.ToString(); }
                string fid = _EluZSDataProvider.GetBindFname("房屋征收产权置换协议" + newtemp);
                string url = "../../../cjWs//HtmlPage/HtmlMainPage.aspx?iid=" + iid + "&UserId=-1&FormName=" + fid + "&input_index=0&act=Print";
                if (sbr1.Length > 0) { sbr1.Append(";"); }
                sbr1.Append(url);
            }
            showtempurl.Text = sbr1.ToString().TrimEnd(';');
            for (int temp = 2; temp < 16; temp = temp + 2)
            {
                //string tempstr = "房屋征收货币补偿协议";
                //tempstr += temp;
                //tempurlo += Bind2(tempstr) + ";";
                string newtemp = string.Empty;
                if (temp.ToString().Length == 1) { newtemp = "0" + temp.ToString(); }
                else { newtemp = temp.ToString(); }
                string fid = _EluZSDataProvider.GetBindFname("房屋征收产权置换协议" + newtemp);
                string url = "../../../cjWs//HtmlPage/HtmlMainPage.aspx?iid=" + iid + "&UserId=-1&FormName=" + fid + "&input_index=0&act=Print";
                if (sbr2.Length > 0) { sbr2.Append(";"); }
                sbr2.Append(url);
            }
            showtempurlo.Text = sbr2.ToString().TrimEnd(';');


            Label dycs = (Label)FindControl("dycs");
            EluZSProvider.Cqzhxy cqzhxy = _EluZSDataProvider.GetCqzhxy(strid);
            dycs.Text = cqzhxy.打印次数;
        }
        public static string Bind(string fname)
        {
            string strid = HttpContext.Current.Request["ID"];
            EluZSProvider.EluZSDataProvider _EluZSDataProvider = (EluZSProvider.EluZSDataProvider)Antu.Core.Services.ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
            string fid = _EluZSDataProvider.GetBindFname(fname);
            string iid = _EluZSDataProvider.GetSomeStr("zs_cqzhxy", "iid", "id", strid);
            string url = "../../../cjWs//HtmlPage/HtmlMainPage.aspx?iid=" + iid + "&UserId=-1&FormName=" + fid + "&input_index=0&act=Print";
            return url;
        }
    }
}
